package com.sziit.se.highconcurrency.order.application.service.impl;

import com.sziit.se.highconcurrency.order.application.entity.OrderDetail;
import com.sziit.se.highconcurrency.order.application.mapper.OrderDetailMapper;
import com.sziit.se.highconcurrency.order.application.service.IOrderDetailService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author dongchunkeng
 * @since 2022-11-09
 */
@Service
@AllArgsConstructor
public class OrderDetailServiceImpl extends ServiceImpl<OrderDetailMapper, OrderDetail> implements IOrderDetailService {

    private final OrderDetailMapper orderDetailMapper;

    @Override
    public List<OrderDetail> getAllData() {
        return orderDetailMapper.getAllData();
    }

    @Override
    public Boolean insertOrderDetail(String orderId, String productId, int amount) {
        return orderDetailMapper.insertOrderDetail(orderId, productId, amount);
    }

    @Override
    public List<OrderDetail> getProductByOrderId(String orderId) {
        return orderDetailMapper.getProductByOrderId(orderId);
    }

    @Override
    public OrderDetail getProductByOrderIdAndProductId(String orderId, String productId) {
        return orderDetailMapper.getProductByOrderIdAndProductId(orderId, productId);
    }
}
